import request from '@/utils/request'

//  后台登陆
export function login (data) {
  return request({
    url: '/admin/login',
    method: 'post',
    data: data
  })
}

// 退出登陆
export function logout (data) {
  return request({
    url: '/user/loginOut',
    method: 'get',
    params: data
  })
}

// 更改密码
export function changePass (data) {
  return request({
    url: '/user/changePassword',
    method: 'put',
    data: data
  })
}

// 用户登陆
export function userLogin (data) {
  return request({
    url: 'user/login',
    method: 'post',
    data: data
  })
}

// 激活账户
export function activeAccount (data, userid) {
  return request({
    url: `/user/activationAccount/${userid}`,
    method: 'get',
    params: data
  })
}

// 忘记密码
export function forgetPass (data, email) {
  return request({
    url: `user/forgetPassword/${email}`,
    method: 'put',
    data: data
  })
}

// 发送忘记密码的邮件
export function sendEmailOfPassword (data) {
  return request({
    url: 'user/sendEmailOfForgetPwd',
    method: 'get',
    params: data
  })
}

// 根据id查询用户
export function getUserById ({userid}) {
  return request({
    url: `user/getUser/${userid}`,
    method: 'get',
    params: userid
  })
}

// 判读用户信息是否完善
export function isPefectInfo (data) {
  return request({
    url: 'user/isPerfectInfo',
    method: 'get',
    params: data
  })
}

// 用户注册
export function register (data) {
  return request({
    url: 'user/register',
    method: 'post',
    data: data
  })
}

// 完善个人信息
export function perfectInfo (data) {
  return request({
    url: 'user/PerfectInfo',
    method: 'put',
    data: data
  })
}
